﻿
@using Microsoft.AspNetCore.Identity
@using PYNET.Models

@inject SignInManager<User> SignInManager
@inject UserManager<User> UserManager

<div id="user-model">
    @if (!SignInManager.IsSignedIn(User)) { 
        <div id="user-model-unlogin">
        <a asp-action="Register" asp-controller="Account"><p class="itm-son-r">注册</p></a>
        <p class="itm-son-m">|</p>
        <a asp-action="Login" asp-controller="Account"><p class="itm-son-r">登录</p></a>
</div>
    }
    else { 
<div id="user-model-login">

    <a asp-action="MyAccount" asp-controller="Account">
        <p class="itm-son-r">@UserManager.GetUserName(User)</p>
        <img class="user-pic" src="/Account/GetUserHead/@UserManager.GetUserId(User)">
    </a>
    @if (User.IsInRole("Admin"))
    {
        <a asp-action="TotalManage" asp-controller="AcMana">
            <p class="itm-son-r">管理中心</p>
        </a>
    }
    else
    {
        <a asp-action="ArticleCreate" asp-controller="Account">
            <p class="itm-son-r">创建文章</p>
        </a>
    }
</div>
    }
</div>